<template>
  <view class="Loader" v-if="flag">
    <view class="wrapper">
      <view class="icon"> </view>
      <view class="text Animated FadeInUp">{{ text }}</view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      flag: false,
      text: "",
    };
  },
  methods: {
    show(text) {
      this.text = text || "请稍等...";
      this.flag = true;
    },
    hide(cb) {
      const that = this;
      setTimeout(() => {
        that.flag = false;
        cb && cb();
      }, 300);
    },
  },
};
</script>
<style scoped lang="scss">
.Loader {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
  z-index: 999999;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;

  .wrapper {
    position: relative;
    padding: 20rpx 40rpx;
    background-color: #fff;
    border-radius: 20rpx;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
    .icon {
      width: 70rpx;
      height: 70rpx;
      background-image: var(--Img_Order_Gif);
      background-repeat: no-repeat;
      background-size: cover;
      background-position: center center;
    }
    .text {
      font-size: 26rpx;
      margin-left: 10rpx;
      color: #333;
    }
  }
}
</style>
